
public class Pair {
	private Object l = null;
	private Object r = null;
	
	public Pair(Object l, Object r) {
		this.l = l;
		this.r = r;
	}
	
	// returns the left object of the pair
	public Object getLeft() {
		return l;
	}
	
	// returns the right object of the pair
	public Object getRight() {
		return r;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((l == null) ? 0 : l.hashCode());
		result = prime * result + ((r == null) ? 0 : r.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		Pair other = (Pair) obj;
		if (l == null) {
			if (other.l != null) {
				return false;
			}
		} else if (!l.equals(other.l)) {
			return false;
		}
		if (r == null) {
			if (other.r != null) {
				return false;
			}
		} else if (!r.equals(other.r)) {
			return false;
		}
		return true;
	}
	
	@Override
	public String toString(){
		String s = "null";
		if(l != null)
			s = l.toString();
		
		s += ": ";
		
		if(r != null)
			s += r.toString();
		else 
			s += "null";
		
		return s;
	}
}
